<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
         <li class="active"><a href="drugslist">药品列表</a></li>
         <li><a href="drugsadd">药品添加</a></li>
    </ul>
	<form class="well form-inline margin-top-20" method="get" action="">
		分类:
		<select class="form-control" name="category" style="width: 140px;">
			<option value=''>全部</option>
			<option value='0'>未审核</option>
			<option value='1'>已通过</option>
			<option value='2'>未通过</option>

		</select> &nbsp;&nbsp;
		关键字:
		<input type="text" class="form-control" name="keyword" style="width: 200px;"
			   value="" placeholder="请输入关键字...">
		<input type="submit" class="btn btn-primary" value="搜索"/>
	</form>
    <form method="post" class="js-ajax-form" action="">
       <!-- <div class="table-actions">
            <button type="submit" class="btn btn-primary btn-sm js-ajax-submit">{:lang('SORT')}</button>
            <button class="btn btn-primary btn-sm js-ajax-submit" type="submit"
                    data-action="{:url('AdminCategory/toggle',array('display'=>'1'))}" data-subcheck="true">
                {:lang('DISPLAY')}
            </button>
            <button class="btn btn-primary btn-sm js-ajax-submit" type="submit"
                    data-action="{:url('AdminCategory/toggle',array('hide'=>1))}" data-subcheck="true">{:lang('HIDE')}
            </button>
        </div>-->

            <table class="table table-hover table-bordered table-list" id="menus-table">
                <thead>
	                <tr>
	                    <th width="15">
	                        <label>
	                            <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
	                        </label>
	                    </th>
	                    <th width="30">ID</th>
	                  	<th width="50">添加人员</th>
	                  	<th width="50">药品分类</th>
	                  	<th width="50">药品名称</th>
	                  	<th width="50">药品图片</th>
	                  	<th width="50">规格</th>
	                  	<th width="50">药品功效</th>
	                  	<th width="50">禁忌</th>
	                  	<th width="50">服用疗程</th>
	                  	<th width="50">药品资质</th>
						<th width="50">状态</th>
	                  	<th width="50">时间</th>
	                  	<th width="50">操作</th>

	                </tr>
                </thead>
                <tfoot>
        			  <foreach name="res" item="res">
		                <tr>
	                    <th width="15">
	                        <label>
	                            <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
	                        </label>
	                    </th>
	                    <th width="30">{$res['id']}</th>
	                  	<th width="50">{$res['personnel']}</th>
	                  	<th width="50">{$res['level']}</th>
	                  	<th width="50">{$res['drugs_name']}</th>
	                  	<th width="50"><img  src="http://www.youyi.com/upload/{$res['photo_urls']}"></th>
	                  	<th width="50">{$res['rank']}</th>
	                  	<th width="50">{$res['efficiency']}</th>
	                  	<th width="50">{$res['taboo']}</th>
	                  	<th width="50">{$res['drug_course']}</th>
	                  	<th width="50">{$res['aptitude']}</th>
						<th width="50">
							<if condition="$res['status']== 1">
								<span class="label label-danger">未审核</span>
							<elseif condition="$res['status']== 2 "/>
								<span class="label label-success">已通过</span>
							<elseif condition="$res['status']== 3 "/>
								<span class="label label-warning">未通过</span>
						    </if>
						</th>
	                  	<th width="50"><?php echo (date("Y-m-d h:i:s",$res['create_time'])); ?></th>
	                  	<th width="50">
	                  			<a class="btn btn-xs btn-danger js-ajax-delete" class="" href="{:url('Drugs/drugsdelete',array('id'=>$res['id']))}">删除</a>
                       			<a class="btn btn-xs btn-primary" href="{:url('Drugs/drugsupdate',array('id'=>$res['id']))}">修改</a>
	                  	</th>
	                </tr>
		            </foreach>
                </tfoot>
            </table>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script src="__STATIC__/js/jquery.js"></script>
<script>
 $(function(){
 	 $(".btn-primary").click(function(){

 	 })
 	//删除
 	//$(".LevelDelete").click(function(){
 	//	if(window.confirm('确认是否删除？')){
 	//		var LevelId=$(".LevelId").html();
	// 		var data={id:LevelId};
	// 		var url="HosLevelDelete";
	// 		alert(LevelId);
	 	    //$.post(url,data,function(data){
 	    	//   alert(data.msg);
 	    	//},'JSON');
 	//	}
 	//
 	//})
 		//修改
 	//$(".LevelUpdate").click(function(){
 	//	if(window.confirm('确认是否修改？')){
 	//		var LevelId=$("#LevelId").html();
	// 		var data={id:LevelId};
	// 		var url="HosLevelUpdate";
	// 		console.log(LevelId,data,url);
	// 	    $.post(url,data,function(data){
	//
 	//    	});
 	//	}
 	//
 	//})
 })





    $(document).ready(function () {
        Wind.css('treeTable');
        Wind.use('treeTable', function () {
            $("#menus-table").treeTable({
                indent: 20,
                initialState: 'expanded'
            });
        });
    });

    // $(' #menus-table .js-check').change(function () {
    //     console.log('change');
    //     checkNode(this);
    // });
    //
    // function checkNode(obj) {
    //     var $obj   = $(obj);
    //     var $table = $obj.parents('table');
    //
    //     var id       = $obj.data('id');
    //     var parentId = $obj.data('parent_id');
    //
    //     function checkParent(id, parentId, checked) {
    //         console.log('checkParent:' + id);
    //         var $parent = $("tr [data-id='" + parentId + "']", $table);
    //         if ($parent.length > 0) {
    //             $parent.prop("checked", checked);
    //             checkParent($parent.data('id'), $parent.data('parent_id'), checked);
    //         }
    //     }
    //
    //     function checkChild(id, parentId, checked) {
    //         console.log('checkChild:' + id);
    //         var $child = $("tr [data-parent_id='" + id + "']", $table);
    //
    //         if ($child.length > 0) {
    //             $child.prop("checked", checked);
    //             checkChild($child.data('id'), $child.data('parent_id'), checked);
    //         }
    //     }
    //
    //     if ($obj.is(':checked')) {
    //         checkParent(id, parentId, true);
    //         checkChild(id, parentId, true);
    //     } else {
    //         checkParent(id, parentId, false);
    //         checkChild(id, parentId, false);
    //     }
    //     return;
    //     var chk   = $("input[type='checkbox']");
    //     var count = chk.length;
    //
    //     var num       = chk.index(obj);
    //     var level_top = level_bottom = chk.eq(num).attr('level');
    //     for (var i = num; i >= 0; i--) {
    //         var le = chk.eq(i).attr('level');
    //         if (le < level_top) {
    //             chk.eq(i).prop("checked", true);
    //             var level_top = level_top - 1;
    //         }
    //     }
    //     for (var j = num + 1; j < count; j++) {
    //         var le = chk.eq(j).attr('level');
    //         if (chk.eq(num).prop("checked")) {
    //
    //             if (le > level_bottom) {
    //                 chk.eq(j).prop("checked", true);
    //             }
    //             else if (le == level_bottom) {
    //                 break;
    //             }
    //         } else {
    //             if (le > level_bottom) {
    //                 chk.eq(j).prop("checked", false);
    //             } else if (le == level_bottom) {
    //                 break;
    //             }
    //         }
    //     }
    // }
</script>
</body>
</html>